﻿using System;
using System.Xml;
using System.Reflection;
using System.Drawing.Imaging;

namespace ThreeDContentPipeline
{
    public class TextureCubeContent
    {
        public TextureCubeContent(string file)
        {
            XmlDocument document = new XmlDocument();
            Type type = GetType();

            document.Load(file);

            foreach (XmlNode node in document.DocumentElement.ChildNodes)
            {
                XmlElement element = node as XmlElement;

                if (node != null)
                {
                    PropertyInfo propertyInfo = type.GetProperty(element.Name);
                    BitmapImage image = new BitmapImage(element.InnerText);

                    Size = image.Width;

                    propertyInfo.SetValue(this, image, null);
                }
            }
        }

        public int Size
        {
            get;
            private set;
        }

        public BitmapImage NegativeX
        {
            get;
            private set;
        }

        public BitmapImage NegativeY
        {
            get;
            private set;
        }

        public BitmapImage NegativeZ
        {
            get;
            private set;
        }

        public BitmapImage PositiveX
        {
            get;
            private set;
        }

        public BitmapImage PositiveY
        {
            get;
            private set;
        }

        public BitmapImage PositiveZ
        {
            get;
            private set;
        }
    }
}
